home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
self
/
contrib.lha
/
contrib
/
SelfNews
/
synthetics.self
< prev
next >
Wrap
Text File
|
1993-07-24
|
4KB
|
181 lines
"File synthetics.self
created by Ian Wilkinson on Mon Sep 21 17:36:45 1992
Copyright (c) Canon Research Centre Europe, 1992.
All rights reserved."
oddballs userInterface _AddSlotsIfAbsent: ( | ^ syntheticsWarehouse = () | )
syntheticsWarehouse _Define: ( |
_ parent* = traits oddball.
^ participant = ( |
^ behaviour = 2.
^ looks = (
'/ClassParticipant [ ClassCanvas ClassGeneric ]
dictbegin
/name nullstring def
/nameSeenBySystem nullstring def
/homeAddress nullstring def
/loginShell nullstring def
/pic null def
dictend
classbegin
/FillingInX 20 def
/FillingInY 20 def
/ParticipantHeight 25 def
/PicW 64 def
/PicH 64 def
/NameFont /Helvetica findfont 14 scalefont def
/NameFontH NameFont fontheight def
/NewInit { % tk tgStart creationArgs => -
/NewInit super send
[
/tk /tgStart
/name /nameSeenBySystem /homeAddress /loginShell /pic
]
[] methoddict
begin
2 dict dup begin
/QuitApp tgStart def
/NewObserver tgStart 1 add def
end tk /setwireclient self send
NameFont /settextfont self send
/installStdBehaviour self send
end
} def
/installStdBehaviour { % - => -
[] [ /theMenu ] methoddict
begin
/installStdBehaviour super send
/theMenu /Grid framebuffer /new ClassMenu send store
[
[ (Quit) /removeFromWorld ]
[ (Observe) /newObserver ]
] /setitemlist theMenu send
self /settarget theMenu send
theMenu /setmenu self send
end
} def
/newObserver { % cntl => -
[] /NewObserver self messageSelf
} def
/participantIsNamed { % name => -
/name exch store
gsave
self setcanvas
/textfont self send setfont
/minsize [
/bbox self send pop pop
name stringwidth pop FillingInX add ParticipantHeight
] cvx /promote self send
grestore
} def
/Paint { % - => -
[] [ /x /y /w /h ] methoddict
begin
/bbox self send [ /x /y /w /h ] methodstacktodict
x y w h false /Paint3DBox self send
gsave
ColorDict /Blue get setcolor
/textfont self send setfont
pic null eq {
w 2 div h 2 div moveto
name /CenterShow self send
}{
w 2 div h NameFontH sub 5 sub moveto
name /CenterShow self send
gsave
w 2 div PicW 2 div sub
h NameFontH sub PicH sub 10 sub translate
0 0 moveto
PicW PicH scale
pic imagecanvas
grestore
} ifelse
grestore
end
} def
/minsize { % - => width height
gsave
self setcanvas
/textfont self send setfont
name stringwidth pop FillingInX add
pic null eq {
ParticipantHeight
}{
PicW FillingInX add max
PicH NameFontH add FillingInY add
} ifelse
grestore
} def
classend def
'
).
^ instantiate = (
'framebuffer /new ClassParticipant send
/place 1 index send
/new ClassEventMgr send /activate 2 index send
/map exch send
'
).
^ instantiateWithoutInteraction = (
'framebuffer /new ClassParticipant send
/place exch send
'
).
^ customLooks* = ( |
^ removeFromWorld = ('
/removeFromWorld {
self /removeclient Parent send { pop } if
/paint Parent send
%[] /QuitApp self send
%/destroy self send
} /promote
'
).
^ trackMotion = ('
/TrackMotion { % evt => -
/Coordinates get aload pop offsetX offsetY xysub
/move self send
self /client Parent send {
gsave
Parent setcanvas
[ /location self send ]
/SetLayoutData Parent send
grestore
} if
} /promote
'
)
| ).
^ named = (
' /participantIsNamed '.
)
| ).
^ engenderLooks = ( | mirr |
mirr: reflect: self.
mirr do: [ | :aSlot. mirrOnRep |
(aSlot isMethod || aSlot isParent) not
ifTrue: [
mirrOnRep: reflect: aSlot key sendTo: self.
(mirrOnRep includesName: 'looks')
ifTrue: [
postScriptMachine sendPS: (aSlot key sendTo: self) looks
]
]
]
)
| )